<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link type="text/css" href="WEB-INF/newcss.css" rel="stylesheet"/>
        <link type="text/css" rel="stylesheet" href="WEB-INF/bootstrap-theme.css"/>
        <link type="text/css" rel="stylesheet" href="WEB-INF/bootstrap.min.css"/>
        <script language="javascript">
            
           function iniciaAjax() {
                var objetoAjax = false;
                if (window.XMLHttpRequest) {
                    objetoAjax = new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    try {
                        objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch(e) {
                        try {
                            objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch(ex) {
                            objetoAjax = false;
                        }
                    }
                }
                return objetoAjax;
            }
            
            var ini = iniciaAjax();
    
            function executar(op){
                
                var nome = document.getElementById("nome").value;
                var nascimento = document.getElementById("nasc").value;
                var cpf = document.getElementById("cpf").value;
                var obs = document.getElementById("obs").value;
                
                var url = "http://localhost:8080/WebApplication1/gerenciamento?op="+op+"&nome="+nome+"&nasc="+nascimento+"&cpf="+cpf+"&obs="+obs;
                ini.open("GET",url,true);
                ini.onreadystatechange = callback;
                ini.send(null);   
            }
            
              function callback(){
                if (ini.readyState === 4){
                    if (ini.status === 200){ 
                        document.getElementById("respostaServidor").innerHTML = ini.responseText;                    
                    }
                }
            }
            
        </script>
    </head>
    <body>
        <form name="menu" action="gerenciamento">
            Nome       : <input name="nome" id="nome" type="text"/><br>
            CPF        : <input name="cpf" id="cpf" type="text"/><br>
            NASCIMENTO : <input name="nasc" id="nasc" type="text"/> <br>
            OBSERVACAO : <input name="obs" id="obs" type="text"/><br>
            <input type="button" value="cadastrar" onclick="executar(1);"/>
            <input type="button" value="consultar" onclick="executar(0);"/>
        </form>
        <div id="respostaServidor">
          
        </div>
    </body>
</html>
